<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
//前台首页路由
Route::get('/', function (\Modules\Admin\Service\ModuleService $moduleService) {
    //获取当前被设为默认在前台展示的模块数据,调用里面的getDefault()方法
    $module = $moduleService->getDefault();
    //然后调用默认前台展示模块里面的HomeController控制器里面的index方法
    //因为前台默认的展示模块不确定会设置成哪一个，所以组合一个需要被实例化的类
    $class = 'Modules\\'.$module['name'].'\Http\Controllers\HomeController';
    return (new $class)->index();
})->name('/');


//前台用户注册的路由
Route::get('/regist','\Modules\Goods\Http\Controllers\HomeController@regist')->name('regist');
//处理前台用户注册的路由
Route::post('/registers','\Modules\Goods\Http\Controllers\HomeController@register')->name('registers');


//注册前台用户登录路由
Route::get('/logins','\Modules\Goods\Http\Controllers\HomeController@login')->name('logins');
//注册一个处理前台登录的路由
Route::post('/logincl','\Modules\Goods\Http\Controllers\HomeController@logincl')->name('logincl');



//前台列表路由
Route::get('/lists/{cid}','\Modules\Goods\Http\Controllers\HomeController@lists')->name('lists');
//前台商品详情页路由
Route::get('/xiangqing/{gid}','\Modules\Goods\Http\Controllers\HomeController@xiangqing')->name('xiangqing');


//注册个人信息的路由
Route::get('/geren','\Modules\Goods\Http\Controllers\HomeController@geren')->name('geren');
//注册一个账号信息修改的路由
Route::get('/zhangh_anq','\Modules\Goods\Http\Controllers\HomeController@zhanghu_anq')->name('zhanghu_anq');






Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');
//Route::get('/home', function (){
//    return 888;
//});

//注册一个上传图片的路由
Route::any('/upload','UploadController@upload');
//注册一个处理编辑器上传的路由
Route::any('/bianjiqiupload','UploadController@bianjiqiupload');




